﻿<%@ Page Title="" Language="C#" MasterPageFile="~/WebmasterTool/Admin.Master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="Framework.WebmasterTool.FileManagers.Default" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        $(document).ready(function () {
            $("#chkAll").live("change", function () {
                if ($(this).is(":checked")) {
                    $(".checkbox").attr("checked", "checked");
                }
                else {
                    $(".checkbox").removeAttr("checked");
                }
            });
            $(".checkbox").live("click", function () {
                var allCheck = true;
                $(".checkbox").each(function () {
                    if (!$(this).is(":checked")) {
                        allCheck = false;
                        return;
                    }
                });
                if (allCheck == true) {
                    $("#chkAll").attr("checked", "checked");
                }
                else {
                    $("#chkAll").removeAttr("checked");
                }
            });
            $("#<%= btnDelete.ClientID %>").live("click", function () {
                var callFrom = $(this);
                jConfirm('Chắc chắn xoá?', 'Digisky Confirm Dialog',
                function (r) {
                    if (r) {
                        __doPostBack(callFrom.attr('name').replace(/_/g, '$'), '');
                    }
                });
                return false;
            });
        });
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ctlCaption" runat="Server">
    Quản lý File
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="PageContent" runat="Server">
    <asp:Label ID="lblPermissionMessage" runat="server" Font-Bold="true" ForeColor="Red"
        Text="Tài khoản không có quyền truy cập vào trang này" Visible="false"></asp:Label>
    <asp:Panel ID="Panel1" runat="server" Visible="true">
        <div>
            <table border="0" width="785px" cellpadding="0" cellspacing="0" align="center">
                <tr>
                    <td>
                        <table width="100%">
                            <tr>
                                <td width="30%">
                                    <input type="button" onclick='javascript:document.location="UploadFile.aspx"' style="float: left"
                                        value="Upload file" />
                                </td>
                                <td align="right">
                                    <span style="font-weight: bold">Tìm kiếm: </span>
                                    <asp:TextBox ID="txtSearch" runat="server" ValidationGroup="Search" Width="150" />
                                    <asp:Button ID="btnSearch" runat="server" ValidationGroup="Search" Text="Search"
                                        OnClick="btnSearch_Click" />
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td style="padding-top: 5pt;" align="center">
                        <asp:GridView runat="server" Width="785px" HorizontalAlign="Center" ID="grvFileManager"
                            CssClass="grid" AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True"
                            PagerSettings-Mode="NumericFirstLast" GridLines="None" ToolTip="all" OnSorting="grvFileManager_Sorting"
                            OnDataBinding="grvFileManager_DataBinding" OnPageIndexChanging="grvFileManager_PageIndexChanging">
                            <Columns>
                                <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px">
                                    <HeaderTemplate>
                                        <input id="chkAll" type="checkbox" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <input id="chkSelect" runat="server" class="checkbox" type="checkbox" title='<%# Eval("FileID") %>' />
                                    </ItemTemplate>
                                    <HeaderStyle Width="20px" />
                                    <ItemStyle HorizontalAlign="Center" Width="20px" />
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Tên file" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left"
                                    SortExpression="Title">
                                    <ItemTemplate>
                                        <a href='/WebmasterTool/FileManagers/UploadFile.aspx?FileID=<%# Eval("FileID") %>'>
                                            <%# Eval("Title") %></a>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="UserName" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left"
                                    SortExpression="UserName">
                                    <ItemTemplate>
                                        <%# Eval("UserName")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Kiểu file" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left"
                                    HeaderStyle-Width="125" ItemStyle-Width="125">
                                    <ItemTemplate>
                                        <%# Eval("FileType") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="File size" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left"
                                    HeaderStyle-Width="70" ItemStyle-Width="70" SortExpression="FileSize">
                                    <ItemTemplate>
                                        <%# Eval("FileSize")%>
                                        KB
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Duyệt" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    HeaderStyle-Width="60" ItemStyle-Width="60" SortExpression="IsActive">
                                    <ItemTemplate>
                                        <asp:CheckBox ID="chkIsActive" runat="server" Checked='<%# Eval("IsActive")%>' Enabled="false" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Vị trí" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                    HeaderStyle-Width="50" ItemStyle-Width="50" SortExpression="DisplayOrder">
                                    <ItemTemplate>
                                        <%# Eval("DisplayOrder")%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Ngày tạo" HeaderStyle-HorizontalAlign="Left" ItemStyle-HorizontalAlign="left"
                                    HeaderStyle-Width="150" ItemStyle-Width="150" SortExpression="AddedDate">
                                    <ItemTemplate>
                                        <asp:HiddenField ID="hidfAddedDate" runat="server" Value='<%# Eval("AddedDate") %>' />
                                        <%# String.Format("{0:dd/MM/yyyy HH:mm:ss tt}", (DateTime)(Eval("AddedDate")))%>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <EmptyDataTemplate>
                                <table align="center" width="765px" border="0" bgcolor="#ffffcc">
                                    <tr>
                                        <td height="50" align="center">
                                            <div align="center" id="EmptyData">
                                                Không có File.</div>
                                        </td>
                                    </tr>
                                </table>
                            </EmptyDataTemplate>
                        </asp:GridView>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        <br />
                        <asp:Button runat="server" ID="btnDelete" Text=" Xoá các mục đã chọn " OnClick="btnDelete_Click" />
                    </td>
                </tr>
            </table>
            <br />
            <br />
        </div>
    </asp:Panel>
</asp:Content>
